﻿using Knight.Models.Entity;
using Knight.Web.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace WebApp.Areas.Manage.Controllers
{
        [Knight.Web.Infrastructure.Filters.EJAuthorize(LoginUrl = "/Manage/Account/Login", Roles = "Admin")]
        public abstract class BaseAdminController : BaseController
        {

            protected string GetUserId()
            {
                return this.User.Identity.Name;
            }

            protected Administrators GetUser()
            {       
                return CacheHelper.GetCache<Administrators>("Admin_" + this.User.Identity.Name);
            }
            protected override void Initialize(RequestContext requestContext)
            {
                base.Initialize(requestContext);
                this.ValidateRequest = false;
            }
        }
}